<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>流程状态</title>
    <link rel="stylesheet" href="../../component/snaker/snaker.css" type="text/css" media="all"/>
    <link rel="stylesheet" href="../../component/snaker/style.css" type="text/css" media="all"/>
</head>
<body>

</div>

<table class="properties_all" align="center" border="1" cellpadding="0" cellspacing="0" style="margin-top: 0px">
    <div id="snakerflow"
         style="border: 1px solid #d2dde2; margin-top:10px; margin-left:10px; margin-bottom:10px; width:98%;">
    </div>
</table>


<script src="../../component/layui/layui.js"></script>
<script src="../../component/pear/pear.js"></script>


<script src="../../component/snaker/raphael-min.js" type="text/javascript"></script>
<script src="../../component/snaker/jquery-ui-1.8.4.custom/js/jquery.min.js" type="text/javascript"></script>
<script src="../../component/snaker/jquery-ui-1.8.4.custom/js/jquery-ui.min.js" type="text/javascript"></script>
<script src="../../component/snaker/dialog.js" type="text/javascript"></script>
<script src="../../component/snaker/snaker.designer.js" type="text/javascript"></script>
<script src="../../component/snaker/snaker.model.js" charset="utf-8" type="text/javascript"></script>
<script src="../../component/snaker/snaker.editors.js" type="text/javascript"></script>
<script>

    const orderId = getQueryString("orderId");
    const processId = getQueryString("processId");

    function getQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        var r = window.location.search.substr(1).match(reg);
        if (r !== null)
            return unescape(r[2]);
        return "";
    }

    $.ajax({
        type: 'GET',
        url: EasyAdminContext.url + "/flow/process/json",
        data: "processId=" + processId + "&orderId=" + orderId,
        async: false,
        globle: false,
        error: function () {
            alert('数据处理错误！');
            return false;
        },
        success: function (data) {
            display(data.process, data.state);
        }
    });

    function display(process, state) {
        /** view*/
        $('#snakerflow').snakerflow($.extend(true, {
                basePath: "../../component/snaker/",
                ctxPath: EasyAdminContext.url,
                orderId: orderId,
                restore: eval("(" + process + ")"),
                editable: false
            }, eval("(" + state + ")")
        ));

    }
</script>
</body>
</html>
